/***************************************************************************
 *   Ants - library                                                        *
 *                                                                         *
 *   Copyright (C) 2008 by kuerant                                         *
 *                         <kuerant@gmail.com>                             *
 *                                                                         *
 *   This library is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 *   This library is distributed in the hope that it will be usefull, but  *
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      *
 *   Library General Public License for more details.                      *
 *                                                                         *
 *   You should have received a copy of the GNU Library General Public     *
 *   License along with this library; if not, write to the Free Software   *
 *   Foundation, Inc., 59 Temple Place - Suite 330, Boston,                *
 *   MA 02111-1307, USA                                                    *
 ***************************************************************************/

#ifndef ANTS_QUEUE_INCOME_HPP
#define ANTS_QUEUE_INCOME_HPP

#include    <sys/types.h>

#include    <deque>

namespace   ants
{

class   QueueIncome
{

public  :
    QueueIncome()
        :   m_iSize(0)
    {       
    }
    
public  :
    void    push( void* pPacket )
    {
        m_queue.push_back( pPacket );
        
        ++m_iSize;
    }
    
    void* pop( void )
    {
        if (m_iSize < 1) {
            return  NULL;
        }
        
        --m_iSize;
        void*    pPacket = m_queue.front();
        m_queue.pop_front();
        
        return  pPacket;
    }
    
    size_t  size() const    { return m_iSize; }
    bool    empty() const   { return m_iSize < 1; }
    
private :
    size_t  m_iSize;

    std::deque< void* >  m_queue;
    
};  // QueueIncome
    
}   // namespace ants
    
#endif  // ANTS_QUEUE_INCOME_HPP

